<?php


namespace app\api\validate;

use think\Validate;

class LoanOrder extends Validate
{
    //字段规则
    protected $rule = [
        'cash_out_num' => 'require|unique:loan_order',
        'user_id' => 'require',
        'amount_money' => 'require',
        'pay_back_num' => 'require',
        'month_pay_back_money' => 'require',
        'month_pay_back_principal' => 'require',
        'month_pay_back_interest' => 'require',
        'interest' => 'require',
        'status' => 'require',
        'source' => 'require',
        'app_base_id' => 'require',
        'sign' => 'require',
    ];

    //验证器提示信息
    protected $message = [
        'cash_out_num.require' => '请输入单号',
        'cash_out_num.unique' => '单号不可重复',
        'user_id.require' => '用户id不能为空',
        'amount_money.require' => '借款金额不能为空',
        'pay_back_num.require' => '还款期数不能为空',
        'month_pay_back_money.require' => '每月应还金额不能为空',
        'month_pay_back_principal.require' => '每月还款本金不能为空',
        'month_pay_back_interest.require' => '每月还款利息不能为空',
        'interest.require' => '总利息不能为空',
        'status.require' => '贷款状态不能为空',
        'source.require' => '请选择贷款订单来源',
        'app_base_id.require' => '请选择来源app_id',
        'sign.require' => '签名不能位空',

    ];

    //使用场景
    protected $scene = [
        'createLoanOrder' => ['amount_money', 'pay_back_num', 'month_pay_back_money', 'month_pay_back_principal', 'month_pay_back_interest', 'interest', 'source', 'app_base_id'],
    ];
}